package com.baomidou.mybatisplus.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.domain.User;
import com.baomidou.mybatisplus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    // 从
    @GetMapping("/1")
    public void get(){
        userService.listByMap(null);
    }

    // 从
    @GetMapping("/2")
    public void get12(){
        userService.getUsers();
    }

    // 主
    @GetMapping("/3")
    public void get1(){
        User user = new User();
        user.setName("ls");
        user.setAge(20);
        userService.save(user);
        System.out.println("ok");
    }
}
